import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import cartStore from './modules/cart'
import homeStore from './modules/home'
import userStore from './modules/user'

const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)
export default pinia

// ❓思考：能否封装一个 useStore 用于统一获取仓库数据？
// 实现如下：
export const useStore = () => {
  return {
    home: homeStore(),
    user: userStore(),
    cart: cartStore()
  }
}

